<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form id="incluir_form_ato" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('indexAto.xhtml')}" value="Ato" update="@form" immediate="true"/> >
                    <p:commandLink  value="Cadastrar Ato" update="@form" immediate="true"/>
                </div>
                <p:panel header="Editar Ato">
                    <p:messages id="msg"/>
                    <fieldset>
                        <legend>Ato</legend> 
                        <h:panelGrid columns="1" id="panelAll" width="950" >
                            <h:panelGrid columns="2" id="panel"  styleClass="textAlignRight" columnClasses="textAlignRight"> 

                                <h:outputLabel  value="Ato Tipo :" />
                                <p:autoComplete id="atotipo_ato" effect="blind" value="#{managerEditarAtoItem.atoItem.atoTipo}" scrollHeight="200" completeMethod="#{managerAtoTipo.completeAtoTipo}"  
                                                size="45" var="p" itemLabel="#{p.descricao}" itemValue="#{p}" converter="atoTipoConverter" forceSelection="true" converterMessage="Erro, verifique o Fornecedor" 
                                                minQueryLength="3" dropdown="true" required="true" requiredMessage="O campo 'Ato Tipo' é obrigatório"> 
                                    <p:ajax event="itemSelect" listener="#{managerEditarAtoItem.handleSelect}"/>                                        
                                </p:autoComplete>

                                <h:outputLabel value="Código :"/>
                                <p:inputText  id="codigo" value="#{managerEditarAtoItem.atoItem.codigo}"/>

                                <h:outputLabel value="Descrição :"/>
                                <p:inputTextarea  id="descricao" value="#{managerEditarAtoItem.atoItem.descricao}" cols="90"/>

                                <h:outputLabel value="Selo :"/>
                                <p:autoComplete id="tipoSelo" effect="blind" value="#{managerEditarAtoItem.atoItem.tipoSelo}" completeMethod="#{managerTipoSelo.completeTipoSelo}"  
                                                size="45" var="p" itemLabel="#{p.nome}" itemValue="#{p}" converter="tipoSeloConverter" forceSelection="true" converterMessage="Erro, verifique o Tipo Selo" minQueryLength="3" dropdown="true" required="true" requiredMessage="O campo 'Tipo Selo' é obrigato"> 
                                    <p:ajax event="itemSelect" listener="#{managerEditarAtoItem.handleSelectTipoSelo}"/>
                                    <p:column>  
                                        <table >
                                            <tr  style="height:20px; background-color: \##{p.corSelo.cor};">
                                                <td style="width: 20px;"></td>
                                            </tr>
                                        </table>
                                    </p:column>
                                    <p:column>  
                                        #{p.nome}
                                    </p:column>  
                                </p:autoComplete>

                                <h:outputLabel value="Sigla:"/>
                                <p:inputText id="sigla" value="#{managerEditarAtoItem.atoItem.sigla}"/>
                                <h:outputText value="Prazo (Dias):"/>
                                <p:inputText id="prazo" value="#{managerEditarAtoItem.atoItem.prazo}"/>
                                  <h:outputLabel value="Ato Campo :"/>
                               
                               
                                <p:column headerText="Campos">
                                    
                                    <p:pickList id="picklistAtoCampo" style="margin-top: 10px" value="#{managerEditarAtoItem.dualAtoCampo}" var="atoCampo"
                                                itemLabel="#{atoCampo.nome}" converter="atoCampoConverter" itemValue="#{atoCampo}">
                                        <f:facet name="sourceCaption">Campos</f:facet>	
                                        <f:facet name="targetCaption">Campos Selecionados</f:facet>
                                    </p:pickList>
                                    
                                </p:column>
                            </h:panelGrid>



                        </h:panelGrid>
                    </fieldset>
                    <br/>
                    <center>
                        <p:commandButton icon="ui-icon-arrowreturnthick-1-w" value="Cancelar" actionListener="#{managerVisualizarAtoItem.redirect('indexAto.xhtml')}" immediate="true"/>
                        <p:commandButton icon="ui-icon-disk" value="Atualizar" actionListener="#{managerEditarAtoItem.alterar()}" update="sigla, prazo, msg"/>
                    </center>
                </p:panel>

            </h:form>
        </ui:define>
    </ui:composition>

</html>

